<?php

include 'base.php';
$pagesize = 8;

if($is_login == 0){
	echo "<script>";
	echo "alert('Please login or ontact us for new account.');";
	echo "location.href='index.php'";
	echo "</script>";
	die();
}

$url = "products.php";


$sql = "select * from equipment ";


if (! empty ( $_GET ['id'] ) && (int)$_GET['id']) {
	$id = (int)$_GET['id'];
	$sql .= " where id=$id";
} else {
	dheader("/");
}

$doc = $db->do_one_bysql($sql);


//pre($doc);
$cate = $cate2 =array();

$cate = $db->do_one_bysql("select id,gname from games where id=".$doc['gid']);

if($doc['sid']) $cate2 = $db->do_one_bysql("select id,gname from games where id=".$doc['sid']);


$tpl->assign('cate', $cate);
$tpl->assign('cate2', $cate2);

$tpl->assign ( 'doc', $doc );


$tpl->assign ( 'gid', $doc['gid'] );

$tpl->assign ( 'sid', $doc['sid'] );

//pre($docs);


$imgs = $db->do_all_bysql ( "select imgpath from equipment_img   where equipment_id=" . $id );
	$tpl->assign ( 'imgs', $imgs );



$tpl->show("product_detail");

?>